<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    18. 4Sum
   </h1>
   <p>
    Given an array
    <code>
     nums
    </code>
    of
    <em>
     n
    </em>
    integers and an integer
    <code>
     target
    </code>
    , are there elements
    <em>
     a
    </em>
    ,
    <em>
     b
    </em>
    ,
    <em>
     c
    </em>
    , and
    <em>
     d
    </em>
    in
    <code>
     nums
    </code>
    such that
    <em>
     a
    </em>
    +
    <em>
     b
    </em>
    +
    <em>
     c
    </em>
    +
    <em>
     d
    </em>
    =
    <code>
     target
    </code>
    ? Find all unique quadruplets in the array which gives the sum of
    <code>
     target
    </code>
    .
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <p>
    The solution set must not contain duplicate quadruplets.
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <pre>
Given array nums = [1, 0, -1, 0, -2, 2], and target = 0.

A solution set is:
[
  [-1,  0, 0, 1],
  [-2, -1, 1, 2],
  [-2,  0, 0, 2]
]
</pre>
  </div>
  <div>
   <h1 class="question_title">
    18. 四数之和
   </h1>
   <p>
    给定一个包含&nbsp;
    <em>
     n
    </em>
    个整数的数组&nbsp;
    <code>
     nums
    </code>
    &nbsp;和一个目标值&nbsp;
    <code>
     target
    </code>
    ，判断&nbsp;
    <code>
     nums
    </code>
    &nbsp;中是否存在四个元素
    <em>
     a，
    </em>
    <em>
     b，c
    </em>
    &nbsp;和
    <em>
     d
    </em>
    &nbsp;，使得&nbsp;
    <em>
     a
    </em>
    +
    <em>
     b
    </em>
    +
    <em>
     c
    </em>
    +
    <em>
     d
    </em>
    &nbsp;的值与&nbsp;
    <code>
     target
    </code>
    &nbsp;相等？找出所有满足条件且不重复的四元组。
   </p>
   <p>
    <strong>
     注意：
    </strong>
   </p>
   <p>
    答案中不可以包含重复的四元组。
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre>给定数组 nums = [1, 0, -1, 0, -2, 2]，和 target = 0。

满足要求的四元组集合为：
[
  [-1,  0, 0, 1],
  [-2, -1, 1, 2],
  [-2,  0, 0, 2]
]
</pre>
  </div>
 </body>
</html>